eval(function(p,a,c,k,e,d){
    e=function(c){
        return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
        };
        
    if(!''.replace(/^/,String)){
        while(c--){
            d[e(c)]=k[c]||e(c)
            }
            k=[function(e){
            return d[e]
            }];
        e=function(){
            return'\\w+'
            };
            
        c=1
        };
    while(c--){
        if(k[c]){
            p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])
            }
        }
    return p
}('(2($){$.c.f=2(p){p=$.d({g:"!@#$%^&*()+=[]\\\\\\\';,/{}|\\":<>?~`.- ",4:"",9:""},p);7 3.b(2(){5(p.G)p.4+="Q";5(p.w)p.4+="n";s=p.9.z(\'\');x(i=0;i<s.y;i++)5(p.g.h(s[i])!=-1)s[i]="\\\\"+s[i];p.9=s.O(\'|\');6 l=N M(p.9,\'E\');6 a=p.g+p.4;a=a.H(l,\'\');$(3).J(2(e){5(!e.r)k=o.q(e.K);L k=o.q(e.r);5(a.h(k)!=-1)e.j();5(e.u&&k==\'v\')e.j()});$(3).B(\'D\',2(){7 F})})};$.c.I=2(p){6 8="n";8+=8.P();p=$.d({4:8},p);7 3.b(2(){$(3).f(p)})};$.c.t=2(p){6 m="A";p=$.d({4:m},p);7 3.b(2(){$(3).f(p)})}})(C);',53,53,'||function|this|nchars|if|var|return|az|allow|ch|each|fn|extend||alphanumeric|ichars|indexOf||preventDefault||reg|nm|abcdefghijklmnopqrstuvwxyz|String||fromCharCode|charCode||alpha|ctrlKey||allcaps|for|length|split|1234567890|bind|jQuery|contextmenu|gi|false|nocaps|replace|numeric|keypress|which|else|RegExp|new|join|toUpperCase|ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('|'),0,{}));

/*
* @Copyright (c) 2010 Solon Albuquerque
* @Page http://www.inordeste.com.br/maskMoney.js

* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.

* Versao Anterior:	2008 Aurelio Saraiva (aureliosaraiva@gmail.com)
* 					http://inovaideia.com.br/maskInputMoney

*
* SOLON ALBUQUERQUE
* CORRIGIDO SIMBOLOGIA PARA O BRASIL
* BLOQUEADO A SOBREPOSICAO DA MASCARA E DUPLICACAO DE NUMEROS EM
* CASO DE CARREGAMENTO DINAMICO
* RETORNA O VALOR 0,00 EM CASO DE NAO DIGITAR NADA
*/

/*
* @Version: 0.3
* @Release: 2010-07-17
*/
(function($) {
    $.fn.maskMoney = function(settings) {
        settings = $.extend({
            symbol: "R$",
            decimal: ",",
            precision: 2,
            thousands: ".",
            showSymbol:true
        }, settings);

        settings.symbol=settings.symbol+" ";

        return this.each(function() {
            var input=$(this);
            function money(e) {
                e=e||window.event;
                var k=e.charCode||e.keyCode||e.which;
                if (k == 8) { // tecla backspace
                    preventDefault(e);
                    var x = input.val().substring(0,input.val().length-1);
                    input.val(maskValue(x));
                    return false;
                } else if (k == 9) { // tecla tab
                    return true;
                }
                if (k < 48 || k > 57) {
                    preventDefault(e);
                    return true;
                }
                var key = String.fromCharCode(k);  // Valor para o codigo da Chave
                preventDefault(e);
                input.val(maskValue(input.val()+key));
            }

            function preventDefault(e) {
                if (e.preventDefault) { //standart browsers
                    e.preventDefault()
                } else { // internet explorer
                    e.returnValue = false
                }
            }

            function maskValue(v) {
                v = v.replace(settings.symbol,"");
                var a = '';
                var strCheck = '0123456789';
                var len = v.length;
                var t = "";
                if (len== 0) {
                    t = "0.00";
                }
                for (var i = 0; i < len; i++)
                    if ((v.charAt(i) != '0') && (v.charAt(i) != settings.decimal))
                        break;

                for (; i < len; i++) {
                    if (strCheck.indexOf(v.charAt(i))!=-1) a+= v.charAt(i);
                }

                var n = parseFloat(a);
                n = isNaN(n) ? 0 : n/Math.pow(10, settings.precision);
                t = n.toFixed(settings.precision);

                var p, d = (t=t.split("."))[1].substr(0, settings.precision);
                for (p = (t=t[0]).length; (p-=3) >= 1;) {
                    t = t.substr(0,p) + settings.thousands + t.substr(p);
                }
                return setSymbol(t+settings.decimal+d+Array(
                    (settings.precision+1)-d.length).join(0));
            }

            function focusEvent() {
                if (input.val()=="") {
                    input.val(setSymbol(getDefaultMask()));
                } else {
                    input.val(setSymbol(input.val()));
                }
            }

            function blurEvent() {
                if (input.val()==setSymbol(getDefaultMask())) {
                    input.val("0,00");
                } else {
                    input.val(input.val().replace(settings.symbol,"").replace(settings.thousands,""));
                }
            }

            function getDefaultMask() {
                var n = parseFloat("0")/Math.pow(10, settings.precision);
                return (n.toFixed(settings.precision)).replace(
                    new RegExp("\\.", "g"), settings.decimal);
            }

            function setSymbol(v) {
                if (settings.showSymbol) {
                    return settings.symbol+v;
                }
                return v;
            }
			
			
            if($(input).attr('rel') == undefined) {
				
                $(input).attr('rel','ok');
	
                input.bind("keypress",money);
                input.bind("blur",blurEvent);
                input.bind("focus",focusEvent);
	
                input.one("unmaskMoney",function() {
                    input.unbind("focus",focusEvent);
                    input.unbind("blur",blurEvent);
                    input.unbind("keypress",money);
                    if ($.browser.msie)
                        this.onpaste= null;
                    else if ($.browser.mozilla)
                        this.removeEventListener('input',blurEvent,false);
                });
            }
			
        });
    }

    $.fn.unmaskMoney=function() {
        return this.trigger("unmaskMoney");
    };
})(jQuery);
